package com.feige.controller;

import com.feige.common.result.Result;
import com.feige.domain.po.VisitStatsDomainPO;
import com.feige.domain.po.VisitStatsDomainTimerPO;
import com.feige.domain.vo.SearchVo;
import com.feige.service.VisitStatsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author 抖音号：程序员飞哥
 * B站：https://space.bilibili.com/490711252
 * @version 1.0
 * @Title: Study512出品
 * @Description: 我们有一个学习网站：https://www.study512.com
 */
@RestController
public class PCPVController {

    @Autowired
    private VisitStatsService visitStatsService;

    @PostMapping("/pc/pv")
    public Result statpcpv(@RequestBody SearchVo searchVo) {
        List<VisitStatsDomainPO> visitStatsDomainPOS = visitStatsService.findCityPV(searchVo);
        return Result.success(visitStatsDomainPOS);
    }

    @PostMapping("/timer/pv")
    public Result stattimerpv(@RequestBody SearchVo searchVo) {
        List<VisitStatsDomainTimerPO> visitStatsDomainPOS = visitStatsService.findTimerPV(searchVo);
        return Result.success(visitStatsDomainPOS);
    }
}
